package com.athena.dal.entities;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Date;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;


/**
 * The persistent class for the subject database table.
 * 
 */
@Entity
@Table(name="subject")
@NamedQueries({
	@NamedQuery(name="Subject.findByDepartmentId", query="SELECT s FROM Subject s WHERE LOWER(s.departmentId) = LOWER(:departmentId)"),
	@NamedQuery(name="Subject.findByDepartmentAndClassId", query="SELECT s FROM Subject s WHERE LOWER(s.departmentId) = LOWER(:departmentId) AND s.classId = :classId")
})
public class Subject implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(unique=true, nullable=false)
	private int id;

	@Temporal(TemporalType.DATE)
	private Date academicYear;

	private int classId;

	@Column(nullable=false, length=12)
	private String code;

	@Column(nullable=false, length=2)
	private String departmentId;

	@Column(length=256)
	private String description;

	@Column(nullable=false, length=64)
	private String name;

	@Column(nullable=false)
	private int standard;

	@Column(length=2048)
	private String syllabus;

	@Column(nullable=false, length=1)
	private String type;

	@Column(nullable=false)
	private Timestamp updatedAt;
	
	//bi-directional many-to-one association to Teach
	@OneToMany(mappedBy="subject")
	private Set<RoutineRules> routineRules;

	@OneToMany(mappedBy="subject")
	private Set<RoutineInstance> routineInstance;
	
	//bi-directional many-to-one association to Teach
	@OneToMany(mappedBy="subject")
	private Set<Teach> teaches;

	public Subject() {
	}

	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public Date getAcademicYear() {
		return this.academicYear;
	}

	public void setAcademicYear(Date academicYear) {
		this.academicYear = academicYear;
	}

	public int getClassId() {
		return this.classId;
	}

	public void setClassId(int classId) {
		this.classId = classId;
	}

	public String getCode() {
		return this.code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getDepartmentId() {
		return this.departmentId;
	}

	public void setDepartmentId(String departmentId) {
		this.departmentId = departmentId;
	}

	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getStandard() {
		return this.standard;
	}

	public void setStandard(int standard) {
		this.standard = standard;
	}

	public String getSyllabus() {
		return this.syllabus;
	}

	public void setSyllabus(String syllabus) {
		this.syllabus = syllabus;
	}

	public String getType() {
		return this.type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public Timestamp getUpdatedAt() {
		return this.updatedAt;
	}

	public void setUpdatedAt(Timestamp updatedAt) {
		this.updatedAt = updatedAt;
	}	

	public Set<RoutineRules> getRoutineRules() {
		return routineRules;
	}

	public void setRoutineRules(Set<RoutineRules> routineRules) {
		this.routineRules = routineRules;
	}

	public Set<RoutineInstance> getRoutineInstance() {
		return routineInstance;
	}

	public void setRoutineInstance(Set<RoutineInstance> routineInstance) {
		this.routineInstance = routineInstance;
	}

	public Set<Teach> getTeaches() {
		return this.teaches;
	}

	public void setTeaches(Set<Teach> teaches) {
		this.teaches = teaches;
	}

}